// ======================================create date pick
function createDatePicker(ctlname) {
    var id = "#" + ctlname;
    var dateformate ="<s:text name='dateformat'/>";
    var laguage="<s:text name='language'/>";
    $(id).bind("click", function() {
        $("#" + ctlname).innerText=WdatePicker({lang:laguage,startDate:'%y-%M-%d 00:00:00',dateFmt:dateformate,
            alwaysUseStartDate:true});
    });
}
function createDateTimePicker(ctlname) {
    var id = "#" + ctlname;
    var laguage="<s:text name='language'/>";
    var dateTimeformat="<s:text name='dateformat.forclass'/>";
    $(id).bind("click", function() {
        $("#" + ctlname).innerText=WdatePicker({lang:laguage,startDate:'%y-%M-%d 00:00:00',dateFmt:dateTimeformat,
            alwaysUseStartDate:true});

    });
}
function createTimePicker(ctlname) {
//        alert(ctlname);
    var id = "#" + ctlname;
    var dateformate ="<s:text name='dateformat.hour.minute'/>";
    var laguage="<s:text name='language'/>";
//       alert($(id).parent().html());
    $(id).bind("click", function() {
        $("#" + ctlname).innerText=WdatePicker({lang:laguage,startDate:'%y-%M-%d 00:00:00',dateFmt:dateformate,
            alwaysUseStartDate:true});
    });
}

$(document).ready(function() {
    if ($("input.Wdatepicker") != null && $("input.Wdatepicker") != undefined) {
        $("input.Wdatepicker").each(function() {
            createDatePicker(this.id);
        });
    }
    if ($("input.WdateTime") != null && $("input.WdateTime") != undefined) {
        $("input.WdateTime").each(function() {
            createDateTimePicker(this.id);
        });
    }
    if ($("input.WTime") != null && $("input.WTime") != undefined) {
        $("input.WTime").each(function() {
            createTimePicker(this.id);
        });
    }

});

